1. Field of the Invention
The present invention relates to a system for effectively encoding and decoding a speech signal, an audio signal, and so forth.
2. Description of the Related Art
In a digital encoding system for a speech signal, an audio signal, and so forth, the signal transmission or recording rate is decreased by removing redundancy in the signal. An encoding system, referred to as MPEG/Audio Layer I, as defined in a related art reference, ISO/IEC (International Organisation for Standardisation/International Electro-technical Commission) 11172-3, will be described with reference to FIGS. 3 and 4.
A conventional encoder shown in FIG. 3 is composed of an input terminal 1, a signal converting portion 2, an analyzing portion 3, a selecting portion 4, quantizing portions 51 to 53, a multiplexing portion 6, and an output terminal 7. The quantizing portions 51 to 53 differ from each other in the number of quantization steps. In this example, the quantizing portion 51 has three quantization steps. The quantizing portion 52 has seven quantization steps. The quantizing portion 53 has 15 quantization steps. Quantizing portions with more steps than 15 steps are provided in the related art reference, but are omitted in this document for simplification.
This system is based on a sub-band encoding system where an input signal is divided into a plurality of frequency-domain signals, and each frequency-domain signal is independently encoded. Generally, speech and audio signals have larger amplitudes at lower frequencies, the necessary rate to transmit can be decreased by assigning more bits at lower frequency and fewer bits at higher frequency.
In practice, a digitized audio signal, for example, PCM audio samples, is supplied from the input terminal 1. Whenever 32 samples of an audio signal are input into the encoder, the signal converting portion 2 divides the input audio signal into frequency bands and converts the signals into 32 frequency-domain samples. Also the signal converting portion 2 stores 12 sets of frequency-domain signals in a buffer thereof, wherein a set of frequency-domain signals is the 32 frequency-domain samples obtained by one conversion. The 12 sets of frequency-domain signals of each frequency are referred to as one block (32.times.12=384 samples/frame).
The analyzing portion 3 calculates an allowable error at each frequency band in quantizing the frequency-domain signals. For example, when an objective signal to noise (S/N) ratio is used in evaluating the coding quality, the allowable error is kept constant for each frequency-domain signal. When an audio signal is encoded, not only an objective value such as S/N ratio, but a subjective evaluation such as by test listening is high considered. Thus, the encoding of noise may be controlled using a psychoacoustical analysis technology so that the deterioration of the listening quality of the reproduced sound is minimized. Consequently, based on at least one of the input audio signal and the frequency-domain signals, the allowable error should be obtained.
The selecting portion 4 selects one of the quantizing portions 51 to 53 that quantizes frequency-domain signals for each block.
Each of the quantizing portions 51 to 53 receives a block of frequency-domain signals, calculates amplitude information for the frequency-domain signals of each block, encodes the frequency-domain signals with the amplitude information, and outputs the amplitude information and codes of the encoded frequency-domain signals. The amplitude information is obtained up to a value of 2 dB as shown in Table 1.
TABLE 1 ______________________________________ Relation between amplitude index and amplitude Amplitude Index Amplitude ______________________________________ 0 2.0 1 1.587 2 1.260 3 1.0 4 0.794 5 0.630 6 0.5 7 0.397 8 0.315 . . . . . . 62 0.00000120 ______________________________________
In practice, each of the quantizing portions 51 to 53 detects the maximum absolute amplitude values of the frequency-domain signals in each block and rounds the values up to the nearest quantized value provided using the amplitude information indexes. In this example, 63 amplitude information indexes are provided. To send the amplitude information, six bits are required.
In this example, the quantization characteristic is linear. Assuming that the magnitude value of a frequency-domain signal is C, the value by the amplitude information is L, and the number of quantization steps is S, with coefficients A and B corresponding to the number of quantization steps S in Table 2, EQU {A.times.(C/L)+B}.times.(S+1)/2/!
is calculated. The fragments under decimal point of the result calculated are rounded off and the significant high order N bits are obtained. Thereafter, by inverting the most significant bit of the N bits, a code of the frequency-domain signal is obtained.
TABLE 2 ______________________________________ Relation amony number of quantizing steps S, coefficients A and B, and bits N Number of Steps S N A B ______________________________________ 3 2 0.75 -0.25 7 3 0.875 -0.125 15 4 0.9375 -0.0625 ______________________________________
In a dequantizing portion of a decoding apparatus shown in FIG. 4, the most significant bit of the code is inverted and a result Q is obtained. By calculating {2.times.(Q+1)/S}.times.L}, a dequantized signal of the frequency-domain signal can be obtained.
Next, real quantizing and dequantizing processes in an example in which the amplitude values of the frequency-domain signals of one block are 0.10, -0.15, -0.03, 0.20, 0.05, 0.44, 0.05, -0.11, 0.32, -0.40, 0.92, and 0.04 will be described.
In this block, since the maximum amplitude value is 0.92, the nearest amplitude value, 1.0 (amplitude index=3) is selected using Table 1. Corresponding to the above-described calculation, codes obtained in the 15-step quantizing process are 8, 6, 7, 9, 7, 10, 7, 6, 9, 4, 14, and 7. The dequantizing portion dequantizes these codes and obtains 0.133, -0.133, 0.0, 0.267, 0.0, 0.4, 0.0, -0.133, 0.267, -0.400, 0.933, and 0.0.
The 15-step quantizing unit 53 requires four bits for sending a code of one frequency-domain signal. Thus, to send codes of 12 frequency-domain signals of one block, the 15-step quantizing unit 53 requires 48 bits. To send amplitude information, the 15-step quantizing unit 53 also requires six bits. Thus, the 15-step quantizing unit 53 requires a total of 54 bits.
When the quantizing portion selecting portion 4 selects the three-step quantizing portion, codes 1, 1, 1, 1, 1, 2, 1, 1, 1, 0, 2, and 1 are obtained. The dequantized values are 0.0, 0.0, 0.0, 0.0, 0.0, 0.667, 0.0, 0.0, 0.0, -0.677, 0.677, and 0.0.
Thus, the number of bits necessary for sending one block is a total of 30 bits composed of 12 two-bit codes each of which represents a three-level quantized value of each frequency-domain signal and six bits that represent the amplitude information of the block.
As with the dequantizing calculation, the magnitude of the quantizing error is proportional to {(amplitude value L)/(number of quantizing steps S)! of each block. Therefore, as the number of quantizing steps S is increased, the quantizing accuracy of frequency-domain signals can be improved. However, when the number of quantizing steps S is increased, the number of bits N that represent each code is also increased. Thus, the transmission rate increases. consequently, while the quantizing portion selecting portion 4 is adjusting the magnitude of the quantizing error of each frequency-domain signal so that it is proportional to the allowable error defined by the analyzing portion 3, the quantizing portion selecting portion 4 selects a quantizing portion in such a manner that the number of bits necessary for encoding all frequency-domain signals is in a range corresponding to the transmission rate.
The multiplexing portion 6 multiplexes the quantizing portion selection information and an output of a quantizing portion for each block, forms a bit stream, and supplies it through the output terminal 7.
The conventional decoding apparatus is composed of an input terminal 11, a demultiplexing portion 12, a three-step dequantizing portion 81, a seven-step dequantizing portion 82, a 15-step dequantizing portion 83, a signal inverse converting portion 13, and an output terminal 14.
The decoding apparatus receives a multiplexed signal from the input terminal 11. The demultiplexing portion 12 demultiplexes the multiplexed signal into quantizing portion selection information and an output of a quantizing portion. With the quantizing portion selection information, a dequantizing portion corresponding to the quantizing method on the encoding side is selected from the three-step dequantizing portion 81, the seven-step dequantizing portion 82, and the 15-step dequantizing portion 83. Each of the dequantizing portions 81 to 83 separates the output of a quantizing portion into amplitude information and codes of frequency-domain signals. As described above, with the amplitude information, the codes of the frequency-domain signals are dequantized and the frequency-domain signals of each block are reproduced. The signal inverse converting portion 13 inversely converts the frequency-domain signals into a time-domain signal and supplies the resultant signal through the output terminal 14.
In the prior art reference, a quantizing portion that is in common with a block is used. Thus, when the amplitude distribution of the frequency-domain signals is not equal, e.g., when a few of the frequency-domain signals in the block have large projecting amplitudes, such as the eleventh band which has an amplitude value of 0.92 in the sample above, the distribution of quantized codes becomes irregular and the encoding efficiency deteriorates.